﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.ActiveRecord;

namespace Rarous.Gryphoon.Data {
  public class ArticlesRepository : IRepository<Article> {
    #region IRepository<Article> Members

    public Article Get(int id) {
      return ActiveRecordMediator<Article>.FindByPrimaryKey(id);
    }

    public void Save(Article obj) {
      ActiveRecordMediator<Article>.Save(obj);
    }

    public ICollection<Article> Find(string property, object value) {
      var result = ActiveRecordMediator<Article>.FindAllByProperty(typeof(Article), property, value);
      return new List<Article>(result.Cast<Article>());
    }

    #endregion
  }
}
